package io;

import utils.SaveLoad;

public class PlantSiteReadWrite {

	public static final String SITEFILENAME = "sites.txt";

	/**
	 * Writes into sites.txt scSequence where binding sites appears
	 * @param scSequences
	 * @param bindingSites
	 */
	public void writeFile(int [] randomIdx)
	{
		for (int i = 0; i < randomIdx.length; i++)
			SaveLoad.saveFile(SITEFILENAME, "" + randomIdx[i] + "\n");
	}
	
	public int [] loadFile()
	{
		String contents = SaveLoad.loadFile(SITEFILENAME);
		String [] splittedContents = contents.split("\n");
		int [] randomIdx = new int[splittedContents.length];
		int i = 0;
		for (String idx : splittedContents)
		{
			randomIdx[i++] = Integer.parseInt(idx); // assumes only integral format.
		}
		return randomIdx;
	}
}
